package com.itwh.project.mapper;

import com.itwh.project.domain.Course;
import com.itwh.project.domain.LabLaboratoryCourse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.List;

/**
 * <p>
 * 实验室-课程：本实验室可以完成哪些课程的实验 Mapper 接口
 * </p>
 *
 * @author 翁煌
 * @since 2020-07-05
 */
@Repository
public interface LabLaboratoryCourseMapper extends BaseMapper<LabLaboratoryCourse> {
    //找出此实验室有哪些课程可以做
    public List<Long> findCourseIdByLabId(Long lab_id);

    //保存这个课程id和这间实验室的关系
    public Boolean saveCourseId(@Param("college_id") Long college_id,@Param("lab_id")Long lab_id,@Param("cid")Long cid,@Param("by_who")Long by_who,@Param("deleted")Boolean deleted,@Param("last_version")Long last_version);

    //删除实验室-课程的关系 修改deleted=true
    public Boolean updateDeletedByLabIdAndCId(@Param("lab_id")Long lab_id, @Param("cid") Long cid);

    //添加原本存在但是deleted为true的课程，更新deleted为false
    public Boolean updateDeletedByLabIdAndCId2(@Param("lab_id")Long lab_id, @Param("cid") Long cid);

    //根据实验室id和课程id查找是否存在对应关系
    public Course selectLabCourse(@Param("lab_id")Long lab_id,@Param("cid")Long cid);
}
